<template>
	<view class="wrap">
		<view class="title">
			<view class="item" :class="{'active':currentIndex==index}" v-for="(item,index) in title" :key="index" @click="handleIndex(index)">{{item}}</view>
		</view>
		<view class="main">
			<slot name="left" v-if="currentIndex==0">11</slot>
			<slot name="right" v-else>22</slot>
		</view>
	</view>
</template>

<script>
	export default {
		name:"uni-detail-tab",
		props:{
			title:Array,
			
		},
		data() {
			return {
				currentIndex:0
			};
		},
		methods:{
			handleIndex(index){
				console.log(index)
				this.currentIndex = index
			}
		}
	}
</script>

<style lang="less">
	.wrap{
		.title{
			display: flex;
			height: 80rpx;
			.item{
				flex: 1;
				display: flex;
				justify-content: center;
				align-items: center;
			}
			.active{
				color: orange;
			}
		}
	}
</style>
